<html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

    <ui:composition template="layout.xhtml">
        <ui:define name="title">
            #{ managerCriarTipoSelo.tipoSelo.id == null ? 'Cadastrar Tipo de Selo' : 'Editar Tipo de Selo' }
        </ui:define>
        <ui:define name="content">
            <h:form id="criarTipoSeloForm">
                  <div class="actions">
                    <div id="buttons">
                        <p:button value="Pesquisar" outcome="pesquisarTipoSelo.xhtml"
                                  icon="ui-icon-search" styleClass="ui-priority-primary">
                        </p:button>
                    </div>
            </div>
                <p:messages id="criarTipoSeloMessages" autoUpdate="true" />
                <p:fieldset legend="Dados" id="criarTipoSeloPanel">            
                    <div class="row">
                        <div class="column2">
                            <p:outputLabel value="Nome" for="nomeInputText" />
                        </div>
                        <div class="column3">
                            <p:inputText id="nomeInputText" value="#{ managerCriarTipoSelo.tipoSelo.nome  }"
                                         required="true" requiredMessage="Nome é obrigatório" maxlength="60" />
                        </div>
                        <div class="column2">
                            <p:outputLabel value="Aplicação" for="aplicacaoSelectOneMenu" />
                        </div>
                        <div class="column3">
                            <p:selectOneMenu id="aplicacaoSelectOneMenu" value="#{ managerCriarTipoSelo.tipoSelo.aplicacao }"
                                             required="true" requiredMessage="Tipo é obrigatório">
                                <f:selectItems value="#{ enums.aplicacoesSelo() }" />
                            </p:selectOneMenu>
                        </div>
                    </div>

                    <div class="row">
                        <div class="column2">
                            <p:outputLabel value="Descrição" for="descricaoInputText" />
                        </div>
                        <div class="column8">
                            <p:inputTextarea id="descricaoInputText" value="#{ managerCriarTipoSelo.tipoSelo.descricao }"
                                             maxlength="255" />
                        </div>
                    </div>

                    <div class="row">
                        <div class="column2">
                            <p:outputLabel value="Cor" for="corSeloInputText" />
                        </div>
                        <div class="column4">
                            <p:colorPicker id="corSeloInputText" value="#{ managerCriarTipoSelo.tipoSelo.corSelo }"
                                           required="true" requiredMessage="Cor é obrigatório" />
                        </div>
                    </div>
                    
                </p:fieldset>
                <div class="command">
                        <p:commandButton action="#{ managerCriarTipoSelo.salvar() }" oncomplete="widthFix();"
                                         value="Salvar" update="@form" icon="ui-icon-disk"  onsuccess="goY(0);" 
                                         styleClass="ui-priority-primary"/>
                        <p:button value="Cancelar" icon="ui-icon-cancel" href="pesquisarTipoSelo.xhtml" />
                    </div>
            </h:form>
        </ui:define>
    </ui:composition>
</html>